import 'package:flutter/material.dart';

class home extends StatefulWidget {
  const home({Key? key}) : super(key: key);

  @override
  State<home> createState() => _homeState();
}

class _homeState extends State<home> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('flutter组件的运用'),
        backgroundColor: Colors.blue,
        leading: Icon(Icons.home),
        toolbarHeight: 60,
        toolbarOpacity: 1,
        toolbarTextStyle: TextStyle(height: 1,fontWeight: FontWeight.w900),
        iconTheme: IconThemeData(color: Colors.white),
        leadingWidth: 55,
        actions: [
          IconButton(onPressed: ()async{
            // ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("123"),duration: Duration(seconds: 1),));
            await showDialog(
                 barrierDismissible: false,
                 context: context, builder: (c){
              return  AlertDialog(
                title: Text("AlertDialog(弹出提示框组件)"),
                content: Text('在点击事件onPressed:()加async{},\n并写入await showDialog(context: context, builder: (参数名){返回该组件}'),
                actions: [
                  TextButton(onPressed: (){
                    Navigator.pop(context);
                  }, child: Text("取消")),
                  TextButton(onPressed: (){
                    Navigator.pop(context);
                  }, child: Text("确认"))
                ],
              );
            });
          }, icon: Icon(Icons.error_outline))
        ],
      ),
      body: Center(
        child: Column(
          children: [
            Container(
              height:55,
              width: MediaQuery.of(context).size.width,
              child: OutlinedButton(
                  style:  ButtonStyle(
                      shadowColor: MaterialStateProperty.all(Color.fromRGBO(0, 0, 0, 0)),
                      backgroundColor: MaterialStateProperty.all(Colors.white),
                      shape: MaterialStateProperty.all(RoundedRectangleBorder(borderRadius: BorderRadius.zero))
                  ),
                  onPressed: (){
                    Navigator.pushNamed(context, 'AppBar');
                  },
                  child:Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text("AppBar(应用栏组件)",style:TextStyle(color: Colors.black,fontSize: 15),),
                      Icon(Icons.arrow_forward,color: Colors.black,)
                    ],
                  )
              ),
            ),
            Container(
              margin: EdgeInsets.only(top: 0),
              height:55,
              width: MediaQuery.of(context).size.width,
              child: OutlinedButton(
                  style:  ButtonStyle(
                      shadowColor: MaterialStateProperty.all(Color.fromRGBO(0, 0, 0, 0)),
                      backgroundColor: MaterialStateProperty.all(Colors.white),
                      shape: MaterialStateProperty.all(RoundedRectangleBorder(borderRadius: BorderRadius.zero))
                  ),
                  onPressed: (){
                    Navigator.pushNamed(context, 'Drawer');
                  },
                  child:Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text("Drawer(抽屉菜单)",style:TextStyle(color: Colors.black,fontSize: 15),),
                      Icon(Icons.arrow_forward,color: Colors.black,)
                    ],
                  )
              ),
            ),
            Container(
              margin: EdgeInsets.only(top: 0),
              height:55,
              width: MediaQuery.of(context).size.width,
              child: OutlinedButton(
                  style:  ButtonStyle(
                      shadowColor: MaterialStateProperty.all(Color.fromRGBO(0, 0, 0, 0)),
                      backgroundColor: MaterialStateProperty.all(Colors.white),
                      shape: MaterialStateProperty.all(RoundedRectangleBorder(borderRadius: BorderRadius.zero))
                  ),
                  onPressed: (){
                    Navigator.pushNamed(context, 'Tab');
                  },
                  child:Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text("Tab(标签菜单)",style:TextStyle(color: Colors.black,fontSize: 15),),
                      Icon(Icons.arrow_forward,color: Colors.black,)
                    ],
                  )
              ),
            ),
            Container(
              margin: EdgeInsets.only(top: 0),
              height:55,
              width: MediaQuery.of(context).size.width,
              child: OutlinedButton(
                  style:  ButtonStyle(
                      shadowColor: MaterialStateProperty.all(Color.fromRGBO(0, 0, 0, 0)),
                      backgroundColor: MaterialStateProperty.all(Colors.white),
                      shape: MaterialStateProperty.all(RoundedRectangleBorder(borderRadius: BorderRadius.zero))
                  ),
                  onPressed: (){
                    Navigator.pushNamed(context, 'video');
                  },
                  child:Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text("VideoPlayerController(视频播放)",style:TextStyle(color: Colors.black,fontSize: 15),),
                      Icon(Icons.arrow_forward,color: Colors.black,)
                    ],
                  )
              ),
            ),
          ],
        )
      ),
    );
  }
}
